package com.qilu.pe.dao.bean;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

// 患者
public class Patient implements Serializable {
    private static final long serialVersionUID = 8458534415843946384L;

    private String phone;
    private String id;
    private String picture;
    private String birth;
    private String sex;
    private String created_at;
    private String medical;
    private String name;
    private String identity;
    private String uid;

    public String getUid() {
        return uid;
    }

    public String getIdentity() {
        return identity;
    }

    public void setIdentity(String identity) {
        this.identity = identity;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPicture() {
        return picture;
    }

    public void setPicture(String picture) {
        this.picture = picture;
    }

    public String getBirth() {
        return birth;
    }

    public int getAge() {
        try {
            Calendar cal = Calendar.getInstance();
            Date bir = new SimpleDateFormat("yyyy-MM").parse(getBirth());
            cal.setTime(bir);
            return Calendar.getInstance().get(Calendar.YEAR) - cal.get(Calendar.YEAR);
        } catch (Exception e) {
            return -1;
        }
    }

    public void setBirth(String birth) {
        this.birth = birth;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getCreated_at() {
        return created_at;
    }

    public void setCreated_at(String created_at) {
        this.created_at = created_at;
    }

    public String getMedical() {
        return medical;
    }

    public void setMedical(String medical) {
        this.medical = medical;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
